Method for real-time video processing involving retouching of an object in the video

ABSTRACT

Method for real time video processing for retouching an object in a video, comprising: providing an object in the video steam, the object being at least partially and at least occasionally presented in frames of the video; setting a degree of retouching; generating a list of at least one element of the object selected based on a request of retouching and the degree of retouching; detecting the at least one element of the object in the video and parameters of the at least one element; calculating new parameters of the at least one element according to the degree of retouching; detecting characteristic points for each of the at least one element of the object; generating a mesh based on the characteristic points for each of the at least one element of the object; tracking the at least one element of the object in the video, wherein the tracking comprises aligning the mesh for each of the at least one element with a position of the corresponding each of the at least one element; and transforming the frames of the video such that the at least one element of the object is modified by the application of the new parameters to the at least one element of the object using the mesh.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of and claims the benefit of priority of U.S. application Ser. No. 14/314,334, filed Jun. 25, 2014, which claims the benefit of U.S. Provisional Application No. 61/936,016, filed on Feb. 28, 2014, the benefit of priority of each of which is hereby claimed herein, and which applications are hereby incorporated herein by reference in their entireties.

BACKGROUND OF THE INVENTION Technical Field

The disclosed embodiments relate generally to the field of real-time video processing. In particular, present invention relates to a computerized system and a computer-implemented method of real-time video processing that involves retouching an object in a video.

Description of the Related Art

At the present time some programs can provide processing of still images. For example, U.S. Patent Application Publication No. US2007268312, incorporated herein by reference, discloses a method of replacing face elements by some components that is made by users for real-time video. However, it is not possible to process real time video in such a way that an object shown in real time video can be retouched in real time naturally.

Thus, new and improved systems and methods are needed that would enable real time video processing that involves retouching an object in the video.

SUMMARY OF INVENTION

The embodiments described herein are directed to systems and methods that substantially obviate one or more of the above and other problems associated with the conventional technology for real time video processing.

In accordance with one aspect of the embodiments described herein, there is provided a computer implemented method for real time video processing for retouching an object in a video, the method comprising: providing an object in the video steam, the object being at least partially and at least occasionally presented in frames of the video; setting a degree of retouching; generating a list of at least one element of the object selected based on a request of retouching and the degree of retouching; detecting the at least one element of the object in the video and parameters of the at least one element; calculating new parameters of the at least one element according to the degree of retouching; detecting characteristic points for each of the at least one element of the object; generating a mesh based on the characteristic points for each of the at least one element of the object; tracking the at least one element of the object in the video, wherein the tracking comprises aligning the mesh for each of the at least one element with a position of the corresponding each of the at least one element; and transforming the frames of the video such that the at least one element of the object is modified by the application of the new parameters to the at least one element of the object using the mesh

In one or more embodiments, the parameters of the at least one element of the object include its location, shape, color, and properties of a covering layer.

In one or more embodiments, applying the new parameters to the at least one element of the object using the mesh includes: generating a set of first points on the mesh for each of the at least one element of the object based on the actual location of the at least one element; generating a set of second points on the mesh based on the request for retouching; changing location of the at least one element of the object in accordance with the set of first points and the set of second points; and modifying the surrounding area which surrounds the at least one element to avoid distortion of the surrounding area.

In one or more embodiments, applying the new parameters to the at least one element of the object using the mesh includes; generating a set of first points on the mesh for each of the at least one element of the object based on the degree of retouching; generating a set of second points on the mesh based on the set of first points and the degree of retouching; and changing proportions of the at least one element of the object in accordance with the degree of retouching, the set of first points and the set of second points, wherein, for each of the at least one element of the object, the set of first points comes into the set of second points using the mesh.

In one or more embodiments, applying the new parameters to the at least one element of the object using the mesh includes: generating a set of first points on the mesh for each of the at least one element of the object based on the degree of retouching; generating at least one area based on the set of first points for each of the at least one element of the object; and changing color of the at least one area based on the degree of retouching.

In one or more embodiments, applying the new parameters to the at least one element of the object using the mesh includes: generating a set of first points on the mesh for each of the at least one element of the object based on the degree of retouching; generating a covering layer based on the set of first points and the calculated new parameters of the at least one element for each of the at least one element of the object; and applying the generated covering layer to each of the at least one element of the object based on the degree of retouching.

In one or more embodiments, transforming the frames of the video includes: scanning the at least one element of the object in at least two successive frames; generating a ratio of change of the at least one element of the object; and adjusting modification of the at least one element based on the ratio of change of the at least one element.

In one or more embodiments, the object in the video to be retouched is a human face.

In one or more embodiments, the method comprising: detecting parts of the human face which are selected based on the request for retouching; calculating new parameters for the selected parts of the human face to make the parts of the human face be symmetrical relative to the central axis of the human face.

In one or more embodiments, the computer implemented method further comprises: creating a square grid associated with a background of the human face in the video; and transforming the background of the human face using the square grid to achieve blurring of the background.

In one or more embodiments, the processed video comprises a video stream.

In accordance with one aspect of the embodiments described herein, there is provided a computer implemented method of real time video processing for retouching an object in a video, the method comprising: receiving a request for retouching of an object, the object being at least partially and at least occasionally presented in frames of the video; setting a degree of retouching; generating an average image of the object based on a plurality of frames of the video and detecting feature reference points of the object; generating a list of at feast one element of the object selected based on the request of retouching and the degree of retouching; detecting the at least one element of the object in the video and parameters of the at least one element; calculating new parameters of the at least one element according to the degree of retouching; calculating characteristic points for each of the at least one element of the object; generating a first mesh based on the characteristic points for each of the at least one element of the object; generating a covering layer based on the average image of the object and the calculated new parameters of the at least one element, wherein the covering layer comprises the average image with the at least one element of the object modified by the application of the calculated new parameters using the first mesh; tracking the feature reference points of the object in the video, wherein the tracking comprises creating a second mesh that is based on the positions of the feature reference points of the object, and aligning the second mesh to the object in each frame; transforming the covering layer based on the second mesh in each frame; aligning the covering layer with the object using the second mesh; transforming the frames of the video such that the object is covered by the covering layer in each frame.

In accordance with one aspect of the embodiments described herein, there is provided a mobile computerized system comprising a central processing unit and a memory, the memory storing instructions for: receiving providing an object in the video steam, the object being at least partially and at least occasionally presented in frames of the video; setting a degree of retouching; generating a list of at least one element of the object selected based on a request of retouching and the degree of retouching; detecting the at least one element of the object in the video and parameters of the at least one element; calculating new parameters of the at least one element according to the degree of retouching; detecting characteristic points for each of the at least one element of the object; generating a mesh based on the characteristic points for each of the at least one element of the object; tracking the at least one element of the object in the video, wherein the tracking comprises aligning the mesh for each of the at least one element with a position of the corresponding each of the at least one element; transforming the frames of the video such that the at least one element of the object is modified by the application of the new parameters to the at least one element of the object using the mesh.

In one or more embodiments, the parameters of the at least one element of the object include its location, shape, color, and properties of a covering layer.

In one or more embodiments, applying the new parameters to the at least one element of the object using the mesh includes: generating a set of first points on the mesh for each of the at least one element of the object based on the actual location of the at least one element; generating a set of second points on the mesh based on the request for retouching; changing location of the at least one element of the object in accordance with the set of first points and the set of second points; and modifying the surrounding area which surrounds the at least one element to avoid distortion of the surrounding area.

In one or more embodiments, applying the new parameters to the at least one element of the object using the mesh includes: generating a set of first points on the mesh for each of the at least one element of the object based on the degree of retouching; generating a set of second points on the mesh based on the set of first points and the degree of retouching; and changing proportions of the at least one element of the object in accordance with the degree of retouching, the set of first points and the set of second points, wherein, for each of the at least one element of the object, the set of first points comes into the set of second points using the mesh.

In one or more embodiments, applying the new parameters to the at least one element of the object using the mesh includes: generating a set of first points on the mesh for each of the at least one element of the object based on the degree of retouching; generating at least one area based on the set of first points for each of the at least one element of the object; and changing color of the at least one area based on the degree of retouching.

In one or more embodiments, applying the new parameters to the at least one element of the object using the mesh includes: generating a set of first points on the mesh for each of the at least one element of the object based on the degree of retouching; generating a covering layer based on the set of first points and the calculated new parameters of the at least one element for each of the at least one element of the object; and applying the generated covering layer to each of the at least one element of the object based on the degree of retouching.

In one or more embodiments, transforming the frames of the video includes: scanning the at least one element of the object in at least two successive frames; generating a ratio of change of the at least one element of the object; and adjusting modification of the at least one element based on the ratio of change of the at least one element.

In one or more embodiments, the object in the video to be retouched is a human face.

In one or more embodiments, calculating new parameters of the at least one element includes: detecting parts of the human face which are selected based on the request for retouching; calculating new parameters for the selected parts of the human face to make the parts of the human face be symmetrical relative to the central axis of the human face.

In one or more embodiments, the computer implemented method further comprises: creating a square grid associated with a background of the human face in the video; and transforming the background of the human face using the square grid to achieve blurring of the background.

BRIEF DESCRIPTION OF DRAWINGS

The accompanying drawings, which are incorporated in and constitute a part of this specification exemplify the embodiments of the present invention and, together with the description, serve to explain and illustrate principles of the inventive technique. Specifically:

FIG. 1 illustrates a method of real-time video processing for retouching an object in a video according to the first embodiment of the invention.

FIG. 2 illustrates a method of real-time video processing for retouching an object in a video according to the second embodiment of the invention.

FIG. 3 illustrates facial feature reference points detected by an ASM algorithm used in the method according to one embodiment of the present invention.

FIG. 4 illustrates Candide-3 model used in the method according to one embodiment of the present invention.

FIG. 5(a) and FIG. 5(b) show an example of a mean face (a) and an example of current observation.

FIG. 6 illustrates Candide at a frame used in the method according to one embodiment of the present invention.

FIG. 7 illustrates an exemplary embodiment of a computer platform based on which the techniques described herein may be implemented.

DETAILED DESCRIPTION OF THE INVENTION

In the following detailed description, reference will be made to the accompanying drawing(s), in which identical functional elements are designated with like numerals. The aforementioned accompanying drawings show by way of illustration, and not by way of limitation, specific embodiments and implementations consistent with principles of the present invention. These implementations are described in sufficient detail to enable those skilled in the art to practice the invention and it is to be understood that other implementations may be utilized and that structural changes and/or substitutions of various elements may be made without departing from the scope and spirit of present invention. The following detailed description is, therefore, not to be construed in a limited sense. Additionally, the various embodiments of the invention as described may be implemented in the form of a software running on a general purpose computer, in the form of a specialized hardware, or combination of software and hardware.

It will be appreciated that the method for real time video processing can be performed with any kind of video data, e.g. video streams, video files saved in a memory of a computerized system of any kind (such as mobile computer devices, desktop computer devices and others), and all other possible types of video data understandable for those skilled in the art. Any kind of video data can be processed, and the embodiments disclosed herein are not intended to be limiting the scope of the present invention by indicating a certain type of video data.

In accordance with one aspect of the embodiments described herein, there are provided a computerized system and a computer-implemented method for real-time video processing involving retouching an object in a video.

The techniques described herein can be implemented using any type of computing device including desktops, laptops, tablet computers, mobile phones, music players, multimedia players etc. having any kind of generally used operational system such as Windows®, iOS®, Android® and others. All disclosed embodiments and examples are non-limiting to the invention and disclosed for illustrative purposes only.

The embodiments disclosed further are aimed for processing of video streams, however all other types of video data including video files saved in a memory of a computerized system can be processed by the methods of the present invention. For example, a user can load video files and save them in a memory of his computerized system and such video files can be also processed by the methods of the present invention.

An exemplary method 100 of real-time video stream processing for retouching an object in a video stream according to the first embodiment of the invention (FIG. 1) is used for an object in a video stream that least partially and at least occasionally presented in frames of the video stream. The method 100 starts with receiving a request for retouching of an object (stage 110) and setting a degree of retouching (stage 120). It shall be noted that the request for retouching and the degree of retouching can be generated automatically by a system or a device implementing this method, or manually by a user. Then, a list of at least one element of the object is generated (stage 130) such that the elements are selected for the list based on the request of retouching and the degree of retouching. It means that number and nature of the elements from the list depends on the request of retouching and the degree of retouching. Further, the elements of the object from the list and their parameters are detected in the video stream (stage 140). The parameters of the elements can include their location, shape, color, and also properties of a covering layer if it is present. Then, new parameters of the elements are calculated according to the degree of retouching (stage 150).

In one or more embodiments, the following stages of the method 100 are aimed for using the new parameters of the elements to transform the frames of the video stream. In particular, characteristic points are detected for each element of the object at stage 160 and a mesh based on the characteristic points for each element of the object is generated at stage 170. The term “characteristic points” shall be understood in the present disclosure as points of the elements which are used for transforming frames of a video stream. The method 100 continues with tracking the elements of the object in the video stream (stage 180). Such tracking includes aligning the mesh for each element with a position of that element. Finally, the new parameters are applied to the elements of the object using the mesh (stage 190) and the elements of the object are modified by the new parameters, thus transforming the frames of the video stream (stage 195).

In one or more embodiments, applying of the new parameters at stage 190 can be performed in different ways. According to one of the embodiments of the invention applying of the new parameters is aimed to change locations of the object's elements and includes the following stages. A set of first points is generated on the mesh for each element of the object based on the actual location of the element; and a set of second points is generated on the mesh based on the request for retouching. Finally, locations of the elements of the object are changed in accordance with the set of first points and the set of second points. Here, to avoid distortion of surrounding area which surrounds the elements, the surrounding area is also modified.

In one or more embodiments, applying of the new parameters is aimed to change proportions of the object's elements and includes the following stages. A set of first points is generated on the mesh for each element of the object based on the degree of retouching; and a set of second points is generated on the mesh based on the set of first points and the degree of retouching. Then, proportions of the elements of the object are changed in accordance with the degree of retouching and the sets of first and second points.

In one or more embodiments, it is also possible when applying of the new parameters is performed to change colors of the objects' elements. In this case a set of first points is generated on the mesh for each element of the object based on the degree of retouching, and at least one area is generated on the basis of the set of first points mesh for each of the at least one element of the object. Colors of the at least one area are changed based on the degree of retouching.

In some embodiments applying of the new parameters involves using a covering layer, which covers certain areas on an object to be retouched. More specifically, applying of the new parameters in this case includes generating of a set of first points on the mesh for each element of the object based on the degree of retouching and generating a covering layer based on the set of first points and calculated new parameters for element of the object. Finally, the generated covering layer is applied for each one area based on the degree of retouching.

In one or more embodiments, it is possible to reduce calculations in the present invention by analyzing changes of an object in several successive frames. For example, transforming of frames of the video stream can further include scanning the elements of the object in at least two successive frames and generating a ratio of change of the elements of the object. The generated ratio of change is then used to adjust modification of the elements.

As would be understood by those skilled in the art, an object in the video stream chosen to be retouched can be a human face. In this case, according to one of the embodiments of the inventions, stage 150 of calculating new parameters of the at least one element includes detecting parts of a human face to be retouched which are selected based on the request for retouching; and calculating new parameters for the parts of the human face to make those parts be symmetrical relative to the central axis of the human face.

Also the following blurring effect for a human face as an object can be used. Here, the method according to the present invention also comprises creating a square grid associated with a background of a human face in the video stream; and transforming the background of the human face using the square grid to achieve blurring of the background.

In one or more embodiments, Retouching can be also performed using a common covering layer for an object in the video stream. Such method 200 for retouching an object in a video stream according to the second embodiment of the invention is illustrated in FIG. 1. First, a request for retouching of an object which is at least partially and at least occasionally presented in frames of the video stream is received (stage 210). Then, the method 200 includes setting a degree of retouching (stage 220). Next, an average image of the object is generated based on a plurality of frames of the video stream and feature reference points of the object are detected (stage 230). The average image of the object can be generated at least several frames of the video stream. The average object and the feature reference points are used for generating a covering layer and its aligning with the object as mentioned below. Further, a list of at least one element of the object which is selected based on the request of retouching and the degree of retouching is generated (stage 240); and the at least one element of the object and parameters of the at least one element are detected (stage 250). Next, new parameters of the at least one element are calculated according to the degree of retouching (stage 255); and characteristic points for each of the at least one element of the object are calculated (stage 260). The method 200 further includes generating a first mesh based on the characteristic points for each of the at least one element of the object (stage 265), and generating a covering layer based on the average image of the object and the calculated new parameters of the at least one element (stage 270). It shall be noted that the covering layer comprises the average image with the at least one element of the object modified by the new parameters using the first mesh. Further, the feature reference points of the object are tracked (stage 275). Here, tracking includes creating of a second mesh that is based on the positions of feature reference points of the object, and aligning the second mesh to the object in each frame. Finally, the method 200 includes transforming the covering layer based on the second mesh in each frame (stage 280), aligning the covering layer with the object using the second mesh (stage 285), and transforming the frames of the video stream such that the object is covered by the covering layer in each frame (stage 290).

Face detection and face tracking techniques are discussed in greater detail below.

Face Detection and Initialization

In one or more embodiments, first in the algorithm for changing proportion a user sends a request for changing proportions of an object in a video stream. The next step in the algorithm involves detecting the object in the video stream.

In one or more embodiments, the face is detected on an image with use of Viola-Jones method. Viola-Jones method is a fast and quite accurate method used to detect the face region. Then, an Active Shape Model (ASM) algorithm is applied to the face region of an image to detect facial feature reference points. However, it should be appreciated that other methods and algorithms suitable for face detection can be used.

In one or more embodiments, for locating facial features locating of landmarks is used. A landmark represents a distinguishable point present in most of the images under consideration, for example, the location of the left eye pupil (FIG. 2).

In one or more embodiments, s set of landmarks forms a shape. Shapes are represented as vectors: all the x- followed by all the y-coordinates of the points in the shape. One shape is aligned to another with a similarity transform (allowing translation, scaling, and rotation) that minimizes the average Euclidean distance between shape points. The mean shape is the mean of the aligned training shapes (which in the present disclosure are manually landmarked faces).

Subsequently, in accordance with the ASM algorithm, the search for landmarks from the mean shape aligned to the position and size of the face determined by a global face detector is started. It then repeats the following two steps until convergence (i) suggest a tentative shape by adjusting the locations of shape points by template matching of the image texture around each point (ii) conform the tentative shape to a global shape model. The individual template matches are unreliable and the shape model pools the results of the weak template matchers to form a stronger overall classifier. The entire search is repeated at each level in an image pyramid, from coarse to fine resolution. It follows that two types of submodel make up the ASM: the profile model and the shape model.

In one or more embodiments, the profile models (one for each landmark at each pyramid level) are used to locate the approximate position of each landmark by template matching. Any template matcher can be used, but the classical ASM forms a fixed-length normalized gradient vector (called the profile) by sampling the image along a line (called the whisker) orthogonal to the shape boundary at the landmark. During training on manually landmarked faces, at each landmark the mean profile vector g and the profile covariance matrix Sg are calculated. During searching, the landmark along the whisker to the pixel whose profile g has lowest Mahalanobis distance from the mean profile g is displaced, where the MahalanobisDistance=(g−g )^(T) S _(g) ⁻¹(g−g ).  (1)

In one or more embodiments, the shape model specifies allowable constellations of landmarks. It generates a shape {circumflex over (x)} with {circumflex over (x)}=x +_b  (2)

where {circumflex over (x)} (is the mean shape, is a parameter vector, and is a matrix of selected eigenvectors of the covariance matrix Sg of the points of the aligned training shapes. Using a standard principal components approach, model has as much variation in the training set as it is desired by ordering the eigenvalues λi of Ss and keeping an appropriate number of the corresponding eigenvectors in ϕ. In the method is used a single shape model for the entire ASM but it is scaled for each pyramid level.

Subsequently, the Equation 2 is used to generate various shapes by varying the vector parameter b. By keeping the elements of b within limits (determined during model building) it is possible to ensure that generated face shapes are lifelike.

Conversely, given a suggested shape x, it is possible to calculate the parameter b that allows Equation 2 to best approximate x with a model shape x{circumflex over ( )}. An iterative algorithm, described by Cootes and Taylor, that gives the b and T that minimizes distance(x,T( x +_b))  (3)

where T is a similarity transform that maps the model space into the image space is used.

In one or more embodiments, mapping can be built from facial feature reference points, detected by ASM, to Candide-3 point, and that gives us Candide-3 points x and y coordinates. Candide is a parameterized face mask specifically developed for model-based coding of human faces. Its low number of polygons (approximately 100) allows fast reconstruction with moderate computing power. Candide is controlled by global and local Action Units (AUs). The global ones correspond to rotations around three axes. The local Action Units control the mimics of the face so that different expressions can be obtained.

The following equation system can be made, knowing Candide-3 points x and y coordinates.

$\begin{matrix} {{{\sum\limits_{j = 1}^{m}{X_{ij}*B_{j}}} = x_{i}},} & (4) \end{matrix}$ $\begin{matrix} {{{\sum\limits_{j = 1}^{m}{Y_{ij}*B_{j}}} = y_{i}},} & (5) \end{matrix}$

where Bj—j-th shape unit, xi, yi—i-th point coordinates, Xij, Yij—coefficients, which denote how the i-th point coordinates are changed by j-th shape unit. In this case, this system is over determined, so it can be solved precisely. Thus, the following minimization is made:

$\begin{matrix} \left. {\left( {{\sum\limits_{j = 1}^{m}{X_{ij}*B_{j}}} - x_{i}} \right)^{2} + \left( {{\sum\limits_{j = 1}^{m}{Y_{ij}*B_{j}}} - y_{i}} \right)^{2}}\rightarrow{\min } \right. & (6) \end{matrix}$ Let's denote X=(X _(ij))^(T),(Y _(ij))^(T))^(T) ,x=((x _(i))^(T),(y _(i))^(T))^(T),=(B _(j))^(T).  (7) This equation system is linear, so its solution is B=(X ^(T) X)⁻¹ X ^(T) x  (8)

In one or more embodiments, it is also possible to use Viola-Jones method and ASM to improve tracking quality. Face tracking methods usually accumulate error over time, so they can lose face position after several hundred frames. In order to prevent it, in the present invention the ASM algorithm is run from time to time to re-initialize tracking algorithm.

Face Tracking

In one or more embodiments, the next step comprises tracking the detected object in the video stream. In the present invention the abovementioned Candide-3 model is used (see Ahlberg, J.: Candide-3, an updated parameterized face. Technical report, Linköping University, Sweden (2001)) for tracking face in a video stream. The mesh or mask corresponding to Candide-3 model is shown in FIG. 3.

In one or more embodiments, a state of the model can be described by shape units intensity vector, action units intensity vector and a position-vector. Shape units are some main parameters of a head and a face. In the present invention the following 10 units are used:

-   -   Eyebrows vertical position     -   Eyes vertical position     -   Eyes width     -   Eyes height     -   Eye separation distance     -   Nose vertical position     -   Nose pointing up     -   Mouth vertical position     -   Mouth width     -   Chin width

In one or more embodiments, action units are face parameters that correspond to some face movement. In the present invention the following 7 units are used:

-   -   Upper lip raiser     -   Jaw drop     -   Lip stretcher     -   Left brow lowerer     -   Right brow lowerer     -   Lip corner depressor     -   Outer brow raiser

In one or more embodiments, the mask position at a picture can be described using 6 coordinates: yaw, pitch, roll, x, y, scale. The main idea of the algorithm proposed by Dornaika et al. (Dornaika, F., Davoine, F.: On appearance based face and facial action tracking. IEEE Trans. Circuits Syst. Video Technol. 16(9):1107-1124 (2006)) is to find the mask position, which observes the region most likely to be a face. For each position it is possible to calculate observation error—the value which indicates the difference between image under current mask position and the mean face. An example of the mean face and of the observation under current position is illustrated in FIGS. 5(a)-5(b) corresponds to the observation under the mask shown in FIG. 6.

In one or more embodiments, face is modeled as a picture with a fixed size (width=40 px, height=46 px) called a mean face. Gaussian distribution that proposed in original algorithms has shown worse result in comparison with static image. So the difference between current observation and a mean face is calculated in the following way: e(b)=Σ

(log(1+I _(m))−log(1+

I _(i)))²  (9)

Logarithm function makes tracking more stable.

In one or more embodiments, to minimize error Taylor series is used as it was proposed by Dornaika at. el. (see F. Dornaika, F. Davoine, On appearance based face and facial action tracking, in IEEE Transactions on Circuits and Systems for Video Technology, 16(9), September, 2006, p. 1107-1124). It was found that it is not necessary to sum up a number of finite differences when calculating an approximation to first derivative. Derivative is calculated in the following way:

$\begin{matrix} {g_{ij} = \frac{{W\left( {y_{t},{b_{t} + {\_ b_{t}}}} \right)}_{ij} - {W\left( {y_{t},{b_{t} + {\_ b_{t}}}} \right)}_{ij}}{- j}} & (10) \end{matrix}$

Here g_(ij) is an element of matrix G. This matrix has size m*n, where m is large enough (about 1600) and n is small (about 14). In case of straight-forward calculating there have to be done n*m operations of division, To reduce the number of divisions this matrix can be rewritten as a product of two matrices: G=A*B Where matrix A has the same size as G and its element is: a _(ij) =W(y _(t) ,b _(t)+_b _(t))_(ij) −W(y _(t) ,b _(t)_b _(t))_(ij)  (11) and matrix B is a diagonal matrix with sizes n*n, and b_(ii)=_(−i) ⁻¹

Now Matrix G_(t) ⁺ has to be obtained and here is a place where a number of divisions can be reduced. G _(t) ⁺(G ^(T) G)⁻¹ G ^(T)=(B _(T) A ^(T) AB)⁻¹ B ^(T) A ^(T) =B ⁻¹(A ^(T) A)⁻¹ B ⁻¹ BA ^(T) =B ⁻¹(A ^(T) A)⁻¹ A ^(T)  (12)

After that transformation this can be done with n*n divisions instead of m*n.

One more optimization was used here. If matrix G is created and then multiplied to ^(□)b_(t) it leads to n²m operations, but if first A^(T) and ^(□)b_(t) are multiplied and then B⁻¹(A^(T)A)⁻¹ with it, there will be only n*m+n³ operations, that is much better because n<<m.

Thus, the step of tracking the detected object in the video stream in the present embodiment comprises creating a mesh that is based on the detected feature reference points of the object and aligning the mesh to the object on each frame.

It should be also noted that to increase tracking speed in the present invention multiplication of matrices is performed in such a way, that it can be boosted using ARM advanced SIMD extensions (also known as NEON). Also, the GPU is used instead of CPU whenever possible. To get high performance of the GPU operations in the present invention are grouped in a special way.

Thus, tracking according to an exemplary embodiment of the invention has the following advantageous features:

1. Before tracking Logarithm is applied to the grayscale value of each pixel to track it. This transformation has a great impact to tracking performance.

2. In the procedure of gradient matrix creation, the step of each parameter depends on the scale of the mask.

Exemplary Computer Platform

FIG. 7 is a block diagram that illustrates an embodiment of a computer system 500 upon which various embodiments of the inventive concepts described herein may be implemented. The system 500 includes a computer platform 501, peripheral devices 502 and network resources 503.

The computer platform 501 may include a data bus 504 or other communication mechanism for communicating information across and among various parts of the computer platform 501, and a processor 505 coupled with bus 504 for processing information and performing other computational and control tasks. Computer platform 501 also includes a volatile storage 506, such as a random access memory (RAM) or other dynamic storage device, coupled to bus 504 for storing various information as well as instructions to be executed by processor 505, including the software application for implementing multifunctional interaction with elements of a list using touch-sensitive devices described above. The volatile storage 506 also may be used for storing temporary variables or other intermediate information during execution of instructions by processor 505. Computer platform 501 may further include a read only memory (ROM or EPROM) 507 or other static storage device coupled to bus 504 for storing static information and instructions for processor 505, such as basic input-output system (BIOS), as well as various system configuration parameters. A persistent storage device 508, such as a magnetic disk, optical disk, or solid-state flash memory device is provided and coupled to bus 504 for storing information and instructions.

Computer platform 501 may be coupled via bus 504 to a touch-sensitive display 509, such as a cathode ray tube (CRT), plasma display, or a liquid crystal display (LCD), for displaying information to a system administrator or user of the computer platform 501. An input device 510, including alphanumeric and other keys, is coupled to bus 504 for communicating information and command selections to processor 505. Another type of user input device is cursor control device 511, such as a mouse, a trackball, or cursor direction keys for communicating direction information and command selections to processor 505 and for controlling cursor movement on touch-sensitive display 509. This input device typically has two degrees of freedom in two axes, a first axis (e.g., x) and a second axis (e.g., y), that allows the device to specify positions in a plane. To detect user's gestures, the display 509 may incorporate a touchscreen interface configured to detect user's tactile events and send information on the detected events to the processor 505 via the bus 504.

An external storage device 512 may be coupled to the computer platform 501 via bus 504 to provide an extra or removable storage capacity for the computer platform 501. In an embodiment of the computer system 500, the external removable storage device 512 may be used to facilitate exchange of data with other computer systems.

The invention is related to the use of computer system 500 for implementing the techniques described herein. In an embodiment, the inventive system may reside on a machine such as computer platform 501. According to one embodiment of the invention, the techniques described herein are performed by computer system 500 in response to processor 505 executing one or more sequences of one or more instructions contained in the volatile memory 506. Such instructions may be read into volatile memory 506 from another computer-readable medium, such as persistent storage device 508. Execution of the sequences of instructions contained in the volatile memory 506 causes processor 505 to perform the process steps described herein. In alternative embodiments, hard-wired circuitry may be used in place of or in combination with software instructions to implement the invention. Thus, embodiments of the invention are not limited to any specific combination of hardware circuitry and software.

The term “computer-readable medium” as used herein refers to any medium that participates in providing instructions to processor 505 for execution. The computer-readable medium is just one example of a machine-readable medium, which may carry instructions for implementing any of the methods and/or techniques described herein. Such a medium may take many forms, including but not limited to, non-volatile media and volatile media. Non-volatile media includes, for example, optical or magnetic disks, such as the persistent storage device 508. Volatile media includes dynamic memory, such as volatile storage 506.

Common forms of computer-readable media include, for example, a floppy disk, a flexible disk, hard disk, magnetic tape, or any other magnetic medium, a CD-ROM, any other optical medium, punchcards, papertape, any other physical medium with patterns of holes, a RAM, a PROM, an EPROM, a FLASH-EPROM, a flash drive, a memory card, any other memory chip or cartridge, or any other medium from which a computer can read.

Various forms of computer readable media may be involved in carrying one or more sequences of one or more instructions to processor 505 for execution. For example, the instructions may initially be carried on a magnetic disk from a remote computer. Alternatively, a remote computer can load the instructions into its dynamic memory and send the instructions over a telephone line using a modem. A modem local to computer system can receive the data on the telephone line and use an infra-red transmitter to convert the data to an infra-red signal. An infra-red detector can receive the data carried in the infra-red signal and appropriate circuitry can place the data on the data bus 504. The bus 504 carries the data to the volatile storage 506, from which processor 505 retrieves and executes the instructions. The instructions received by the volatile memory 506 may optionally be stored on persistent storage device 508 either before or after execution by processor 505. The instructions may also be downloaded into the computer platform 501 via Internet using a variety of network data communication protocols well known in the art.

The computer platform 501 also includes a communication interface, such as network interface card 513 coupled to the data bus 504. Communication interface 513 provides a two-way data communication coupling to a network link 514 that is coupled to a local network 515. For example, communication interface 513 may be an integrated services digital network (ISDN) card or a modem to provide a data communication connection to a corresponding type of telephone line. As another example, communication interface 513 may be a local area network interface card (LAN NIC) to provide a data communication connection to a compatible LAN. Wireless links, such as well-known 802.11a, 802.11b, 802.11g and Bluetooth may also used for network implementation. In any such implementation, communication interface 513 sends and receives electrical, electromagnetic or optical signals that carry digital data streams representing various types of information.

Network link 514 typically provides data communication through one or more networks to other network resources. For example, network link 514 may provide a connection through local network 515 to a host computer 516, or a network storage/server 522, Additionally or alternatively, the network link 514 may connect through gateway/firewall 517 to the wide-area or global network 518, such as an Internet. Thus, the computer platform 501 can access network resources located anywhere on the Internet 518, such as a remote network storage/server 519. On the other hand, the computer platform 501 may also be accessed by clients located anywhere on the local area network 515 and/or the Internet 518. The network clients 520 and 521 may themselves be implemented based on the computer platform similar to the platform 501.

Local network 515 and the Internet 518 both use electrical, electromagnetic or optical signals that carry digital data streams. The signals through the various networks and the signals on network link 514 and through communication interface 513, which carry the digital data to and from computer platform 501, are exemplary forms of carrier waves transporting the information.

Computer platform 501 can send messages and receive data, including program code, through the variety of network(s) including Internet 518 and LAN 515, network link 515 and communication interface 513. In the Internet example, when the system 501 acts as a network server, it might transmit a requested code or data for an application program running on client(s) 520 and/or 521 through the Internet 518, gateway/firewall 517, local area network 515 and communication interface 513. Similarly, it may receive code from other network resources.

The received code may be executed by processor 505 as it is received, and/or stored in persistent or volatile storage devices 508 and 506, respectively, or other non-volatile storage for later execution.

Finally, it should be understood that processes and techniques described herein are not inherently related to any particular apparatus and may be implemented by any suitable combination of components. Further, various types of general purpose devices may be used in accordance with the teachings described herein. It may also prove advantageous to construct specialized apparatus to perform the method steps described herein. The present invention has been described in relation to particular examples, which are intended in all respects to be illustrative rather than restrictive. Those skilled in the art will appreciate that many different combinations of hardware, software, and fir are will be suitable for practicing the present invention. For example, the described software may be implemented in a wide variety of programming or scripting languages, such as Assembler, C/C++, Objective-C, pert, shell, PHP, Java, as well as any now known or later developed programming or scripting language.

Moreover, other implementations of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. Various aspects and/or components of the described embodiments may be used singly or in any combination in the systems and methods for real time video stream processing. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims. 

What is claimed is:
 1. A computer-implemented method comprising: receiving a video stream depicting an object; generating a request for retouching the object depicted in the received video stream; determining that a covering layer is present in the video stream that covers an area of the object depicted in a reference video frame of the video stream; obtaining one or more properties of the covering layer; detecting an element of the object and a corresponding parameter of the element, the parameter comprising the one or more properties of the covering layer; obtaining a current observation of the object using the video stream; determining a mean face corresponding to the object; and computing an observation error based on a square of a difference between a logarithm of a function of the current observation of the object and the logarithm of the function of the mean face, the element of the object being detected based on the observation error; after determining that the covering layer is presented in the video stream, based on detecting the element of the object and the corresponding parameter that comprises the one or more properties of the covering layer, calculating a new parameter for the detected element of the object according to the request for retouching; modifying the element of the object depicted in the reference video frame based on the new parameter, the modifying comprising: generating an average image of the object based on a plurality of frames of the video stream; modifying the element of the object in the average image based on the calculated new parameter for the element; generating a given covering layer comprising the average image with the element of the object modified based on the calculated new parameter; and aligning the given covering layer, that includes the average image with the modified element, with the object depicted in the video stream to cover the object in each frame of the video stream; and presenting the modified element of the object in the video stream.
 2. The computer-implemented method of claim 1, further comprising: generating a list of elements depicted in the video stream, the list of elements comprising the element of the object, the list of elements selected based on the request for retouching and a degree of retouching; and detecting the element of the object in the video stream and parameters of the element.
 3. The computer-implemented method of claim 1, further comprising: detecting characteristic points for the element of the object; generating a mesh based on the characteristic points for the element of the object; tracking the element of the object in the video stream by aligning the mesh for the element with a position of the element; generating a square grid associated with a background of the object in the video stream; and transforming frames of the video stream to generate modified frames within the video stream such that the background of the object is blurred using the square grid and such that the element of the object is modified.
 4. The computer-implemented method of claim 1, further comprising: generating a set of first points on a mesh for the element of the object based on the request for retouching; generating a set of second points on the mesh based on the set of first points and the request for retouching; and changing proportions of the element of the object in accordance with the request for retouching, the set of first points, and the set of second points, wherein the set of first points comes into the set of second points using the mesh.
 5. The computer-implemented method of claim 1, further comprising: calculating the new parameter for the detected element of the objected covered by the covering layer based on the one or more properties of the covering layer.
 6. The computer-implemented method of claim 1, further comprising: generating a set of first points on a mesh for the element of the object based on the request for retouching; generating the covering layer based on the set of first points; and applying the generated covering layer to the element of the object based on the request for retouching.
 7. The computer-implemented method of claim 1, further comprising: scanning the element of the object in at least two successive frames; generating a ratio of change of the element of the object; and adjusting modification of the element based on the ratio of change.
 8. The computer-implemented method of claim 1, wherein the object in the video stream to be retouched comprises a human face.
 9. The computer-implemented method of claim 8, further comprising: detecting parts of the human face which are selected based on the request for retouching; calculating new parameters for the selected parts of the human face; transforming visual depiction of the parts of the human face in the video stream to be symmetrical relative to a central axis of the human face based on the calculated new parameters.
 10. The computer-implemented method of claim 1, wherein the object is detected based on an eye separation distance, a mouth width, a chin width and action unit information indicating a jaw drop and lip corner depression.
 11. A system, comprising: one or more processors; and a non-transitory processor-readable storage medium coupled to the one or more processors, the non-transitory processor-readable storage medium storing processor executable instructions that, when executed by the one or more processors, cause the one or more processors to perform operations comprising: receiving a video stream depicting an object; generating a request for retouching the object depicted in the received video stream; determining that a covering layer is present in the video stream that covers an area of the object depicted in a reference video frame of the video stream; obtaining one or more properties of the covering layer; detecting an element of the object and a corresponding parameter of the element, the parameter comprising the one or more properties of the covering layer; obtaining a current observation of the object using the video stream; determining a mean face corresponding to the object; and computing an observation error based on a square of a difference between a logarithm of a function of the current observation of the object and the logarithm of the function of the mean face, the element of the object being detected based on the observation error; after determining that the covering layer is presented in the video stream, based on detecting the element of the object and the corresponding parameter that comprises the one or more properties of the covering layer, calculating a new parameter for the detected element of the object according to the request for retouching; modifying the element of the object depicted in the reference video frame based on the new parameter, the modifying comprising: generating an average image of the object based on a plurality of frames of the video stream; modifying the element of the object in the average image based on the calculated new parameter for the element; generating a given covering layer comprising the average image with the element of the object modified based on the calculated new parameter; and aligning the given covering layer, that includes the average image with the modified element, with the object depicted in the video stream to cover the object in each frame of the video stream; and presenting the modified element of the object in the video stream.
 12. The computer-implemented method of claim 1, further comprising: initializing a tracking process to detect the object in the video stream; and from time to time, re-initializing the tracking process to re-detect the object in the video stream to continue modifying the element.
 13. The computer-implemented method of claim 12, wherein the tracking process comprises an Active Shape Model (ASM).
 14. The computer-implemented method of claim 1, further comprising: obtaining grayscale values of each pixel of the object in the video; applying a logarithm to the grayscale values of each pixel of the object in the video before tracking the object; and tracking the object in the video based on the logarithm of the grayscale values.
 15. The computer-implemented method of claim 1, further comprising: training a parametrized model to detect a face using a set of training data comprising training shapes, the training shapes corresponding to manually landmarked faces, wherein during training at each landmark a mean profile vector and a profile covariance matrix are calculated.
 16. The system of claim 11, wherein the operations further comprise: generating a set of first points on a mesh for the element of the object based on the request for retouching; generating the covering layer based on the set of first points; and applying the generated covering layer to the element of the object based on the request for retouching.
 17. The system of claim 11, wherein the operations further comprise: scanning the element of the object in at least two successive frames; generating a ratio of change of the element of the object; and adjusting modification of the element based on the ratio of change.
 18. The system of claim 11, wherein the object is detected based on a shape units intensity vector, an action units intensity vector and a position vector, the position vector indicating vertical positions of eyebrows, eyes, nose and mouth, the position vector further indicating widths of eyes, mouth and chin, the action units intensity vector indicating facial movement comprising upper lip raising, lip stretching, brow rising, and brow lowering.
 19. A non-transitory processor-readable storage medium storing processor executable instructions that, when executed by a processor of a machine, cause the machine to perform operations comprising: receiving a video stream depicting an object; generating a request for retouching the object depicted in the received video stream; determining that a covering layer is present in the video stream that covers an area of the object depicted in a reference video frame of the video stream; obtaining one or more properties of the covering layer; detecting an element of the object and a corresponding parameter of the element, the parameter comprising the one or more properties of the covering layer; obtaining a current observation of the object using the video stream; determining a mean face corresponding to the object; and computing an observation error based on a square of a difference between a logarithm of a function of the current observation of the object and the logarithm of the function of the mean face, the element of the object being detected based on the observation error; after determining that the covering layer is presented in the video stream, based on detecting the element of the object and the corresponding parameter that comprises the one or more properties of the covering layer, calculating a new parameter for the detected element of the object according to the request for retouching; modifying the element of the object depicted in the reference video frame based on the new parameter, the modifying comprising: generating an average image of the object based on a plurality of frames of the video stream; modifying the element of the object in the average image based on the calculated new parameter for the element; generating a given covering layer comprising the average image with the element of the object modified based on the calculated new parameter; and aligning the given covering layer, that includes the average image with the modified element, with the object depicted in the video stream to cover the object in each frame of the video stream; and presenting the modified element of the object in the video stream. 